<!-- vuex 中shopcar数组的信息展示 -->
<template>
  <div class="box">
      <shopgoodsitem v-for="(item,index) in shopcara" :key="index" :shopcaritem="item"></shopgoodsitem>
  </div>
</template>

<script>
import shopgoodsitem from "./shopgoodsitem.vue"
import { mapGetters} from  "vuex"
export default {
  name:"shopgoods",
  // data () {
  //     return {
  //          //搞一个变量存储数据
  //           shopcar:this.$store.state.shopcar
  //     }
  // },
  components: {
      shopgoodsitem
  },
  computed: {
    ...mapGetters(['shopcara'])
  }

}

</script>
<style  scoped>
.box{
   height: 150px;
}
</style>